<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$i = 1;
$root_path = $file['root_path'];
echo $root_path;
?>

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="generator" content="" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link href="/resource/css/haiersoft.css" rel="stylesheet" type="text/css" media="screen,print" />
<link href="/resource/css/print.css" rel="stylesheet" type="text/css"  media="print" />
<script src="/resource/js/jquery-1.10.1.min.js"></script>
<script src="/resource/js/side.js" type="text/javascript"></script>
<script src="/resource/js/mouse.js" type="text/javascript"></script>
<script type="text/javascript">  

</script>

<style type="text/css">
	#NewFolder{width: 300px; height: 40px; line-height:60px;font-size: 18px;float: left;}
	#NewFolder div{height: 40px; padding: 10px 5px 0 40px;}
	#NewFolder div a:hover{background-color: #EB6D48}
	#NewFolder div a{ width: 100px;text-decoration: none;border: 1px solid rgba(200,200,200,0.5);  border-radius: 3px;padding-left: 10px; cursor: pointer; font-size: 15px; color: rgba(0,0,0,0.8); }
	.confirm {width: 150;height: 20;float: right; text-align: center;}
	.last input{ border: none; background: #FFF;outline:none;}
	.last input:hover{cursor: pointer;background-color: #F1F1F1;color: blue}
	 table tr:hover{background-color:#F1F1F1}
	 #filename{background-color: #FFF}
	 table td img{width: 20px;height: 20px; margin-right: 10px}
	 #confirm {display: none;}

	/*右键快捷菜单开始*/
	#quick_menu{
		display:none;
		position:absolute;
		top:0;
		left:0;
		background:#fff;
		box-shadow: 0px 0px 5px #888888;
	}
	#quick_menu li:not(.close){
		padding:8px 20px;
		cursor:pointer;
	}
	#quick_menu li:hover{
		background-color:#eee;
	}
	#quick_menu .close{
		position:absolute;
		width:25px;
		height:25px;
		top:-10px;
		border-radius:50%;
		right:-10px;
		background:#ccc url(/resource/img/close.png) no-repeat center center;
		cursor:pointer;
	}
	#quick_menu .close:hover{
		background-color:#666;
	}
	#folder_menu{
		width: 400px;
		height: auto;
		position:absolute;
		top:200px;
		left:500px;
		background:#fff;
		box-shadow: 0px 0px 5px #888888;
		clear:both;
	}
	#folder_menu li:not(.close){
		padding:8px 20px;
		cursor:pointer;
		border-bottom:1px solid #F1F1F1;
	}
	#folder_menu li:hover{
		background-color:#eee;
	}
	#folder_menu .close{
		position:absolute;
		width:25px;
		height:25px;
		top:-10px;
		border-radius:50%;
		right:-10px;
		background:#ccc url(/resource/img/close.png) no-repeat center center;
		cursor:pointer;
	}
	#folder_menu .close:hover{
		background-color:#666;
	}

	#folder_menu div{ font-size: 18px;  text-align: center;padding:10px 0 10px 0; background-color: #F1F1F1 }

</style>
</head>
<body>
<div class="picBox" onClick="switchSysBar()" id="switchPoint"></div>
<div class="wrap_right">
<div id="Contents">
<div id="MainForm">
	<div class="form_boxB">
			<div id= "NewFolder">
				<div>
					<!-- <a class="folder" style="float: left;" href="javascript:insertInput()">新建文件夹</a>	 -->
					<!-- <a class="confirm" id="confirm" href="javascript:root_create()" >确定</a> -->

				</div>	
					<dir class="confirm">					
			</dir>
			</div>							
			<div style="width: 240px;height: 25px; float: right; padding: 10px 15px 0 0;">
					<input type="text" name="serch" style="float: left;height: 20px;">
					<button style="float: right;">搜索</button>
			</div>	
			<table cellpadding="0" cellspacing="0" >
				<tr>
				<td colspan="10" class="info_boxA">文件夹：全部文件　　　日期：<?php echo date("Y-m-d"); ?>　当前使用空间:<?php echo  $totalSize ?></td>
				</tr>
			</table>
		<table cellpadding="0" cellspacing="0" id="tablehide" >
			<tr>
					<th>序号</th>
					<th>文件名</th>
					<th>文件大小</th>
					<th>所属分类</th>
					<th>最后修改时间</th>		
					<th>详情</th>
					<th>操作</th>
			</tr> 
			<?php foreach ($file as $key => $value):?>

			<tr onmousedown=right_quick(event,this,'file') >
				<td> <?php echo $i++ ?></td>
				<td><img src="<?php echo  getImg(getExt($value->filename)) ?>"> <span class="out" data-vid="<?php echo $value->vid ?>"><?php echo $value->filename; ?></span></td>
				 <td><?php echo getRealSize( $value->size); ?></td>	 
				 <td><?php echo $value->floder ?></td>
				 <td><?php echo $value->modifytime ?></td>		 
				<td class="last"><input class="lookbtn" name="" style=" " type="button" value="查看" ></td>
				<td class="last"><input  type="button" name="" id="rename_file" value="重命名" onclick="rename_file(this)"></td>
			</tr>
			 <?php endforeach;?>		
		</table>
		<table cellpadding="0" cellspacing="0" id="tableshow">	
				
				
		</table>
	</div>
</div>
<!-- /MainForm -->

<!-- BtmMain -->
	<!-- <div id="BtmMain">

		<!-- btn_box -->
		<!-- <div class="btn_box floatR mag_l20">
			<input name="" type="button" value="返回列表" onMouseMove="this.className='input_move'" onMouseOut="this.className='input_out'" onclick="relist()"></div>
		</div>  -->
	<ul id="quick_menu">
	<li onclick="rename_file()">重命名</li>
	<li onclick="del_file()">移动到</li>
	
	</ul>
	<ul id="folder_menu" style="display: none;">
		<div>移动到</div>
		<?php foreach ($file['dirname'] as $key => $value):?>
	<li class="dir" ><input type="radio" name="vehicle" value="<?php echo $value; ?>" class="checkbox"  /><img src="/resource/img/dir.png" style="width: 20px;height: 20px;" ><span> <?php echo $value; ?></span></li>
	 <?php endforeach;?>	
	 <li class="close" onclick="menu_close()"></li>
	 <div class="btn_box  mag_l20" id="">
	 	<input name="queding" type="button" value="确定"  onMouseMove="this.className='input_move'" onMouseOut="this.className='input_out'" onclick="removeFile()" >	
	 	<input name="quxiao" type="button" value="取消"  onMouseMove="this.className='input_move'" onMouseOut="this.className='input_out'" onclick="menu_close()"  >
	 </div>
</ul>
</div>
<!-- /Contents -->
<!-- /footer -->
<footer>
<address>2018 Corporation,All Rights</address>
</footer>
<!-- /footer -->

</div>
<script type="text/javascript">
	function tablehide(){
	
		$("#tablehide").hide();
		}
		function tableshow(){
	
		$("#tableshow").show();
		}		
				$(".lookbtn").click(function(){
					var fileName=$(this).parents("tr").find("input").val();
						$.ajax({
						type:"POST",
						url:"<?php echo'?c=admin&m=main';?>",
						dataType: "json",
						data:{"fileName":fileName},
						success : function(res){
						var	code = res.code;
							if(res.code==0){		
								tablehide();
								 jsonString=res.msg.filer;
								insert(jsonString);								
							}	
						}
					});
				});
				function insert(jsonString){	
					data="<tr><th>序号</th><th>文件名</th><th>文件大小</th><th>最后修改时间</th><th>详情</th><th>操作</th></tr> ";
					$("#tableshow").append(data);
				for(let index in jsonString.filename) { 								
					$("#tableshow").append("<tr onmousedown=right_quick(event,this,'file')><td>"+index+"</td><td ><img src="+jsonString.imgurl[index]+">"+jsonString.filename[index]+"<input  clas='dir' id='filename'  style='display:none' type='text' name='fileName' value="+jsonString.filename[index]+" disabled> </td><td>"+jsonString.filesize[index]+"</td><td>"+jsonString.filetime[index]+"</td> <td class='last'><input class='lookbtn' name='' style='' type='button' value='查看'></td><td class='last'><input type='button' name='' value='重命名'></td></tr>")
						};  					
				}

		function relist(){
			 window.location.href="?c=admin&m=main";
		}

	function opendir(dir){
		$.ajax({
			type:"POST",
			url:"<?php echo base_url().'?c=admin&m=main';?>",
			dataType:"json",
			data:{"dir":"203602"},
			success : function(res){
				if($res.code==0){
					tablehide();
				}	
			}
		});
	}
	</script>
</body>
</html>
